<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath(); String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>

	<head>
		<base href="<%=basePath%>">
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>退换货</title>

		<link href="css/admin.css" rel="stylesheet" type="text/css">
		<link href="css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="css/personals.css" rel="stylesheet" type="text/css">
		<link href="css/refstyle.css" rel="stylesheet" type="text/css">

		<script src="js/jquery.min.js" type="text/javascript"></script>
		<script src="js/amazeui.js" type="text/javascript"></script>

	</head>

	<body>
		<!--头 -->
		<jsp:include page="common/header.jsp"/>
			<b class="line"></b>
		<div class="center">
			<div class="col-main">
				<jsp:include page="common/user_left.jsp"/>
				<div class="main-wrap">
					<!--标题 -->
					<div class="am-cf am-padding">
						<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">退换货申请</strong> / <small>Apply&nbsp;for&nbsp;returns</small></div>
					</div>
					<hr/>
					<div class="comment-list">
					<!--进度条-->
					<div class="m-progress">
						<div class="m-progress-list">
							<span class="step-1 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">1<em class="bg"></em></i>
                                <p class="stage-name">买家申请退款</p>
                            </span>
							<span class="step-2 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">2<em class="bg"></em></i>
                                <p class="stage-name">商家处理退款申请</p>
                            </span>
							<span class="step-3 step">
                                <em class="u-progress-stage-bg"></em>
                                <i class="u-stage-icon-inner">3<em class="bg"></em></i>
                                <p class="stage-name">款项成功退回</p>
                            </span>                            
							<span class="u-progress-placeholder"></span>
						</div>
						<div class="u-progress-bar total-steps-2">
							<div class="u-progress-bar-inner"></div>
						</div>
					</div>
					
						
						<div class="refund-aside">
						<c:forEach items="${order.ogs }" var="og">
							<div class="item-pic">
								<a href="#" class="J_MakePoint">
									<img src="${og.goodsthums}" class="itempic">
								</a>
							</div>

							<div class="item-title">

								<div class="item-name">
									<a href="#">
										<p class="item-basic-info">${og.goodsnames }</p>
									</a>
								</div>
							</div>
							<div class="item-info">
							
								<div class="item-ordernumber">
									<span class="info-title">订单编号：</span><a>${order.orderno }</a>
								</div>
								<div class="item-price">
									<span class="info-title">价&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格：</span><span class="price">${og.goodsprice }</span>
									<span class="number">×${og.goodnums }</span><span class="item-title">(数量)</span>
								</div>
								<div class="item-amount">
									<span class="info-title">小&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;计：</span><span class="amount">${og.goodnums*og.goodnums }元</span>
								</div>
								<div class="item-pay-logis">
									<span class="info-title">运&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;费：</span><span class="price">0.00元</span>
								</div>
								<div class="item-time">
									<span class="info-title">成交时间：</span><span class="time"><fmt:formatDate value="${order.createtime}" pattern="yyyy-MM-dd HH:mm:ss"/></span>
								</div>
								
							</div>
							<div class="clear"></div>
							</c:forEach>
						</div>
						
						<div class="refund-main">
							<div class="item-comment">
								<div class="am-form-group">
									<label for="refund-type" class="am-form-label">退款类型</label>
									<div class="am-form-content">
										<select data-am-selected="">
											<option value="a" selected>仅退款</option>
											<option value="b">退款/退货</option>
										</select>
									</div>
								</div>
								

								<div class="am-form-group">
									<label for="refund-money" class="am-form-label">退款金额<span>（不可修改）</span></label>
									<div class="am-form-content">
										<input type="text" id="refund-money" readonly="readonly" placeholder="${order.realprice }">
									</div>
								</div>
								<div class="am-form-group">
									<label for="refund-info" class="am-form-label">退款说明<span>（可不填）</span></label>
									<div class="am-form-content">
										<form id="frmrefund">
											<input type="hidden" name="orderid" value="${order.orderid }"/>
											<input type="hidden" name="userid" value="${user.userid }"/>
											<textarea name="refundremark" placeholder="请输入退款说明"></textarea>
										</form>
									</div>
								</div>

							</div>
							<div class="info-btn">
								<div onclick="refund(${user.userid});" class="am-btn am-btn-danger">提交申请</div>
							</div>
						</div>
					</div>
					<div class="clear"></div>
				</div>
				<script type="text/javascript">
					function refund(userid){
						$.ajax({
				            cache: true,
				            type: "POST",
				            url:'/refunds/addRefund',
				            data:$('#frmrefund').serialize(),// 你的formid
				            async: false,
				            error: function(request) {
				                alert("Connection error");
				            },
				            success: function(data) {
				            	if(data){
				            		layer.msg('您申请的退款信息，正在被处理！',{icon:1,time:1000});
				            		setTimeout(function(){//两秒后跳转  
				                       location.href='/orders/getorder/'+userid;
				                    },1000);
				            	}else{
				            		layer.msg('申请退款失败！',{icon:2,time:1000});
				            	}
				            }
				        });
					}
				</script>
				<!--底部-->
				<jsp:include page="common/footer.jsp"/>
			</div>
			
		</div>

	</body>

</html>